<script setup lang="ts">
import { useUserStore } from '@/store/user'
import { useAppStore } from '@/store/app'
import { storeToRefs } from 'pinia'
// import { computed } from 'vue'

const userStore = useUserStore()
const appStore = useAppStore()
console.log(appStore.config)
console.log(userStore)
console.log(userStore.name)
const name = computed(() => userStore.name)
const { age } = storeToRefs(userStore)

const updateUserState = () => {
	const { name, age } = userStore.$state
	userStore.updateState({
		name: name + 1,
		age: age + 1
	})
}
</script>
<template>
	<div>姓名：{{ name }}</div>
	<div>年龄：{{ age }}</div>
	<div>计算的名字：{{ userStore.fullName }}</div>
	<div>app的config: {{ appStore.config }}</div>
	<button @click="updateUserState">更新数据</button>
</template>

<style lang="scss" scoped></style>
